group { name: "e/modules/temperature/main";
   images.image: "therm_content.png" COMP;
   min: 16 16;
   max: 128 128;
   script {
    public message(Msg_Type:type, id, ...) {
       if ((type == MSG_FLOAT) && (id == 1)) {
          new Float:val;
          val = getfarg(2);
          set_drag(PART:"temp_top", 0.0, val);
          if (val <= 0.6) set_state(PART:"temp", "default", 0.0);
          else if (val <= 0.8) set_state(PART:"temp", "warm", 0.0);
          else if (val <= 1.0) set_state(PART:"temp", "hot", 0.0);
       }
    }
   }
   parts {
      part { name: "base";
         description { state: "default" 0.0;
            rel.to: "temp";
            image.normal: "therm_content.png";
            color_class: "/bg-dark/normal/gadgets/temperature";
         }
      }
      part { name: "temp";
         clip_to: "temp_clip";
         description { state: "default" 0.0;
            aspect: 0.5 0.5; aspect_preference: BOTH;
            align: 0.5 0.5;
            max: 80 160;
            image.normal: "therm_content.png";
            color_class: "/fg/normal/gadgets/temperature/low";
         }
         description { state: "warm" 0.0;
            inherit: "default" 0.0;
            color_class: "/fg/normal/gadgets/temperature/medium";
         }
         description { state: "hot" 0.0;
            inherit: "default" 0.0;
            color_class: "/fg/normal/gadgets/temperature/hi";
         }
      }
      part { name: "e.text.reading"; type: TEXT;
         scale: 1;
         clip_to: "fade_clip";
         description { state: "default" 0.0;
            visible: 0;
            color_class: "/fg/normal/gadgets/temperature/text";
            color: 255 255 255 0; // no cc
            text { font: FN; size: 10;
               min: 1 1;
               ellipsis: -1;
               text_class: "module_small";
            }
         }
         description { state: "visible" 0.0;
            inherit: "default" 0.0;
            visible: 1;
            color: 255 255 255 255; // no cc
         }
      }
      part { name: "fade_clip"; type: RECT;
         description { state: "default" 0.0;
            color: 255 255 255 255; // no cc
         }
         description { state: "faded" 0.0;
            color: 255 255 255 64; // no cc
         }
      }
      part { name: "temp_clip"; type: RECT;
         clip_to: "fade_clip";
         description { state: "default" 0.0;
            rel1.to_y: "temp_top";
         }
      }
      part { name: "temp_top"; type: SPACER;
         dragable.x: 0 0 0;
         dragable.y: -1 1 0;
         dragable.confine: "temp_limit";
         description { state: "default" 0.0;
         }
      }
      part { name: "temp_limit"; type: SPACER;
         description { state: "default" 0.0;
            rel.to: "temp";
            rel1.relative: 0.0 0.1;
            rel2.relative: 1.0 0.9;
         }
      }
      part { name: "over"; type: RECT;
         description { state: "default" 0.0;
            color: 0 0 0 0; // no cc
         }
      }
   }
   programs {
      program { signal: "mouse,in"; source: "over";
         action: STATE_SET "visible" 0.0;
         transition: LINEAR 0.3;
         target: "e.text.reading";
      }
      program { signal: "mouse,out"; source: "over";
         action: STATE_SET "default" 0.0;
         transition: LINEAR 1.0;
         target: "e.text.reading";
      }
      program { signal: "e,state,known"; source: "e";
         action: STATE_SET "default" 0.0;
         target: "fade_clip";
      }
      program { signal: "e,state,unknown"; source: "e";
         action: STATE_SET "faded" 0.0;
         target: "fade_clip";
      }
   }
}

